#coding=utf-8
import random
from random import randint
money = 1000
while money > 0:
    print('你的总资产为：',money)
    needs_go_on = False
    while True:
        duzhu = int(input('请下注：'))
        if duzhu>money:
            print("请重新下注",duzhu)
        elif 0 < duzhu <= money:
            dianshu1 = random.randint(1,6)
            dianshu2 = random.randint(1,6)
            zongdiasnshu = dianshu1+dianshu2
            print("骰子1：",dianshu1)
            print("骰子2:",dianshu2)
            print("点数",zongdiasnshu)
            if zongdiasnshu == 7 or zongdiasnshu == 11:
                money += duzhu
                print("点数为7或11 玩家胜")
                print("当前资产：",money)
            elif zongdiasnshu == 2 or zongdiasnshu == 3 or zongdiasnshu == 12:
                money -= duzhu
                print("点数为2或3或12庄家胜")
                print("当前资产：",money)
            else:
                onedianshu = zongdiasnshu
                while True:
                    print("继续摇骰子")
                    dianshu1 = random.randint(1, 6)
                    dianshu2 = random.randint(1, 6)
                    zongdiasnshu = dianshu1 + dianshu2
                    print("骰子1：", dianshu1)
                    print("骰子2:", dianshu2)
                    print("点数", zongdiasnshu)
                    if zongdiasnshu == onedianshu:
                        money += duzhu
                        print("点数为第一次点数玩家胜")
                        print("当前资产：",money)
                        break
                    elif zongdiasnshu ==7:
                        money-=duzhu
                        print("点数为7庄家胜")
                        print("当前资产：",money)
                        break
        if money<=0:
            print("破产了，游戏结束")
            break
